res_item = []
res = []

def dfs(edges, s, N):
    global res_item
    res_item.append(s)
    if s == N:
        res.append(res_item)
        print(' '.join(map(str, res_item)))
        return
    
    for t in edges[s]:
        dfs(edges, t, N)
        res_item.pop()
    
def main():
    N, M = map(int, input().split())
    edges = [[] for i in range(N+1)]
    
    for i in range(M):
        s, t = map(int, input().split())
        edges[s].append(t)
        
    dfs(edges, 1, N)
    if not res:
        print(-1)
    
main()